var api = require('../../../api/api');
var md5 = require('../../../utils/md5.min');

Page({
    data: {
        username: '',
        password: '',
    },
    bindUsernameInput(e) {
        this.setData({
            username: e.detail.value
        });
    },
    bindPasswordInput(e) {
        this.setData({
            password: e.detail.value
        });
    },
    onLogin: function () {//点击登录
        api.login({
            userName: this.data.username,
            userPwd: md5(this.data.password),
        }).then(res => {
            wx.setStorageSync('token', res.result.token);
            wx.navigatorTo({
                url: '/pages/index/index'
            });
        });
    }
})